package com.dudu.timer;

import com.dudu.dao.ImsLogDao;
import com.dudu.dao.InterfaceLogDao;
import com.dudu.dao.SystemLogDao;
import com.dudu.model.ImsLog;
import com.dudu.model.InterfaceLog;
import com.dudu.model.SystemLog;

import core.CoreDao;
/**
 * 日志保存线程
 * @author gaoxs
 *
 */
public class SavelogThread implements Runnable {
	private CoreDao coredao = null;
	private SystemLogDao syslogdao=null;
	private ImsLogDao imslogdao=null;
	private InterfaceLogDao interfaceLogdao=null;
	private Object bean;
	public SavelogThread(CoreDao coredao,Object bean,SystemLogDao dao){
		this.coredao=coredao;
		this.bean=bean;
		this.syslogdao=dao;
	}
	public SavelogThread(CoreDao coredao,Object bean,ImsLogDao dao){
		this.coredao=coredao;
		this.bean=bean;
		this.imslogdao=dao;
	}
	public SavelogThread(CoreDao coredao,Object bean,InterfaceLogDao dao){
		this.coredao=coredao;
		this.bean=bean;
		this.interfaceLogdao=dao;
	}
	@Override
	public void run() {
		if(null !=syslogdao){
			syslogdao.insert(coredao, (SystemLog)bean);
		}
		if(null !=imslogdao){
			imslogdao.insert(coredao, (ImsLog)bean);
		}
		if(null !=interfaceLogdao){
			interfaceLogdao.insert(coredao, (InterfaceLog)bean);
		}
	}
	
}
